﻿namespace mathtest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
            for(var i=0;i<100;i++)
            {
                Test1();
            }
        }
       
        static void Test1()
        {
            Random ran = new Random(1);

            Vector3 vec = Vector3.Random(ran);
            for (var i = 0; i < 1000000; i++)
            {
                vec = Vector3.Add(vec, Vector3.Random(ran));
            }
            vec.x /= 100.0f;
            vec.y /= 100.0f;
            vec.z /= 100.0f;
            Console.WriteLine("result=" + vec.x + "," + vec.y + "," + vec.z);
        }
    }
    struct Vector3
    {
        public Vector3(float _x,float _y,float _z)
        {
            this.x= _x;
            this.y= _y;
            this.z= _z;
        }
        public float x, y, z;
        public static Vector3 Random(Random ran)
        {
            return new Vector3(ran.NextSingle()-0.5f,ran.NextSingle() - 0.5f, ran.NextSingle() - 0.5f);
        }
        public static Vector3 Add(Vector3 a,Vector3 b)
        {
            return new Vector3(a.x+b.x,a.y+b.y,a.z+b.z);
        }
    }
}